package org.apache.commons.httpclient;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Hashtable;
import java.util.Locale;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.net.URLCodec;
import org.apache.commons.httpclient.util.EncodingUtil;

public class URI
  implements Cloneable, Comparable, Serializable
{
  protected static final BitSet IPv4address;
  protected static final BitSet IPv6address;
  protected static final BitSet IPv6reference;
  protected static final BitSet URI_reference;
  protected static final BitSet abs_path;
  protected static final BitSet absoluteURI;
  public static final BitSet allowed_IPv6reference;
  public static final BitSet allowed_abs_path;
  public static final BitSet allowed_authority;
  public static final BitSet allowed_fragment;
  public static final BitSet allowed_host;
  public static final BitSet allowed_opaque_part;
  public static final BitSet allowed_query;
  public static final BitSet allowed_reg_name;
  public static final BitSet allowed_rel_path;
  public static final BitSet allowed_userinfo;
  public static final BitSet allowed_within_authority;
  public static final BitSet allowed_within_path;
  public static final BitSet allowed_within_query;
  public static final BitSet allowed_within_userinfo;
  protected static final BitSet alpha;
  protected static final BitSet alphanum;
  protected static final BitSet authority;
  public static final BitSet control;
  protected static String defaultDocumentCharset;
  protected static String defaultDocumentCharsetByLocale;
  protected static String defaultDocumentCharsetByPlatform;
  protected static String defaultProtocolCharset = "UTF-8";
  public static final BitSet delims;
  protected static final BitSet digit;
  public static final BitSet disallowed_opaque_part;
  public static final BitSet disallowed_rel_path;
  protected static final BitSet domainlabel;
  protected static final BitSet escaped;
  protected static final BitSet fragment;
  protected static final BitSet hex;
  protected static final BitSet hier_part;
  protected static final BitSet host;
  protected static final BitSet hostname;
  protected static final BitSet hostport;
  protected static final BitSet mark;
  protected static final BitSet net_path;
  protected static final BitSet opaque_part;
  protected static final BitSet param;
  protected static final BitSet path;
  protected static final BitSet path_segments;
  protected static final BitSet pchar;
  protected static final BitSet percent;
  protected static final BitSet port;
  protected static final BitSet query;
  protected static final BitSet reg_name;
  protected static final BitSet rel_path;
  protected static final BitSet rel_segment;
  protected static final BitSet relativeURI;
  protected static final BitSet reserved;
  protected static final char[] rootPath;
  protected static final BitSet scheme;
  protected static final BitSet segment;
  static final long serialVersionUID = 604752400577948726L;
  protected static final BitSet server;
  public static final BitSet space;
  protected static final BitSet toplabel;
  protected static final BitSet unreserved;
  public static final BitSet unwise;
  protected static final BitSet uric;
  protected static final BitSet uric_no_slash;
  protected static final BitSet userinfo;
  public static final BitSet within_userinfo;
  protected char[] _authority;
  protected char[] _fragment;
  protected char[] _host;
  protected boolean _is_IPv4address;
  protected boolean _is_IPv6reference;
  protected boolean _is_abs_path;
  protected boolean _is_hier_part;
  protected boolean _is_hostname;
  protected boolean _is_net_path;
  protected boolean _is_opaque_part;
  protected boolean _is_reg_name;
  protected boolean _is_rel_path;
  protected boolean _is_server;
  protected char[] _opaque;
  protected char[] _path;
  protected int _port;
  protected char[] _query;
  protected char[] _scheme;
  protected char[] _uri;
  protected char[] _userinfo;
  protected int hash;
  protected String protocolCharset;

  static
  {
    defaultDocumentCharset = null;
    defaultDocumentCharsetByLocale = null;
    defaultDocumentCharsetByPlatform = null;
    Locale localLocale = Locale.getDefault();
    if (localLocale != null)
    {
      defaultDocumentCharsetByLocale = LocaleToCharsetMap.getCharset(localLocale);
      defaultDocumentCharset = defaultDocumentCharsetByLocale;
    }
    try
    {
      defaultDocumentCharsetByPlatform = System.getProperty("file.encoding");
      if (defaultDocumentCharset == null)
        defaultDocumentCharset = defaultDocumentCharsetByPlatform;
      char[] arrayOfChar = new char[1];
      arrayOfChar[0] = '/';
      rootPath = arrayOfChar;
      percent = new BitSet(256);
      percent.set(37);
      digit = new BitSet(256);
      for (int i = 48; i <= 57; ++i)
        digit.set(i);
      alpha = new BitSet(256);
      for (int j = 97; j <= 122; ++j)
        alpha.set(j);
      for (int k = 65; k <= 90; ++k)
        alpha.set(k);
      alphanum = new BitSet(256);
      alphanum.or(alpha);
      alphanum.or(digit);
      hex = new BitSet(256);
      hex.or(digit);
      for (int l = 97; l <= 102; ++l)
        hex.set(l);
      for (int i1 = 65; i1 <= 70; ++i1)
        hex.set(i1);
      escaped = new BitSet(256);
      escaped.or(percent);
      escaped.or(hex);
      mark = new BitSet(256);
      mark.set(45);
      mark.set(95);
      mark.set(46);
      mark.set(33);
      mark.set(126);
      mark.set(42);
      mark.set(39);
      mark.set(40);
      mark.set(41);
      unreserved = new BitSet(256);
      unreserved.or(alphanum);
      unreserved.or(mark);
      reserved = new BitSet(256);
      reserved.set(59);
      reserved.set(47);
      reserved.set(63);
      reserved.set(58);
      reserved.set(64);
      reserved.set(38);
      reserved.set(61);
      reserved.set(43);
      reserved.set(36);
      reserved.set(44);
      uric = new BitSet(256);
      uric.or(reserved);
      uric.or(unreserved);
      uric.or(escaped);
      fragment = uric;
      query = uric;
      pchar = new BitSet(256);
      pchar.or(unreserved);
      pchar.or(escaped);
      pchar.set(58);
      pchar.set(64);
      pchar.set(38);
      pchar.set(61);
      pchar.set(43);
      pchar.set(36);
      pchar.set(44);
      param = pchar;
      segment = new BitSet(256);
      segment.or(pchar);
      segment.set(59);
      segment.or(param);
      path_segments = new BitSet(256);
      path_segments.set(47);
      path_segments.or(segment);
      abs_path = new BitSet(256);
      abs_path.set(47);
      abs_path.or(path_segments);
      uric_no_slash = new BitSet(256);
      uric_no_slash.or(unreserved);
      uric_no_slash.or(escaped);
      uric_no_slash.set(59);
      uric_no_slash.set(63);
      uric_no_slash.set(59);
      uric_no_slash.set(64);
      uric_no_slash.set(38);
      uric_no_slash.set(61);
      uric_no_slash.set(43);
      uric_no_slash.set(36);
      uric_no_slash.set(44);
      opaque_part = new BitSet(256);
      opaque_part.or(uric_no_slash);
      opaque_part.or(uric);
      path = new BitSet(256);
      path.or(abs_path);
      path.or(opaque_part);
      port = digit;
      IPv4address = new BitSet(256);
      IPv4address.or(digit);
      IPv4address.set(46);
      IPv6address = new BitSet(256);
      IPv6address.or(hex);
      IPv6address.set(58);
      IPv6address.or(IPv4address);
      IPv6reference = new BitSet(256);
      IPv6reference.set(91);
      IPv6reference.or(IPv6address);
      IPv6reference.set(93);
      toplabel = new BitSet(256);
      toplabel.or(alphanum);
      toplabel.set(45);
      domainlabel = toplabel;
      hostname = new BitSet(256);
      hostname.or(toplabel);
      hostname.set(46);
      host = new BitSet(256);
      host.or(hostname);
      host.or(IPv6reference);
      hostport = new BitSet(256);
      hostport.or(host);
      hostport.set(58);
      hostport.or(port);
      userinfo = new BitSet(256);
      userinfo.or(unreserved);
      userinfo.or(escaped);
      userinfo.set(59);
      userinfo.set(58);
      userinfo.set(38);
      userinfo.set(61);
      userinfo.set(43);
      userinfo.set(36);
      userinfo.set(44);
      within_userinfo = new BitSet(256);
      within_userinfo.or(userinfo);
      within_userinfo.clear(59);
      within_userinfo.clear(58);
      within_userinfo.clear(64);
      within_userinfo.clear(63);
      within_userinfo.clear(47);
      server = new BitSet(256);
      server.or(userinfo);
      server.set(64);
      server.or(hostport);
      reg_name = new BitSet(256);
      reg_name.or(unreserved);
      reg_name.or(escaped);
      reg_name.set(36);
      reg_name.set(44);
      reg_name.set(59);
      reg_name.set(58);
      reg_name.set(64);
      reg_name.set(38);
      reg_name.set(61);
      reg_name.set(43);
      authority = new BitSet(256);
      authority.or(server);
      authority.or(reg_name);
      scheme = new BitSet(256);
      scheme.or(alpha);
      scheme.or(digit);
      scheme.set(43);
      scheme.set(45);
      scheme.set(46);
      rel_segment = new BitSet(256);
      rel_segment.or(unreserved);
      rel_segment.or(escaped);
      rel_segment.set(59);
      rel_segment.set(64);
      rel_segment.set(38);
      rel_segment.set(61);
      rel_segment.set(43);
      rel_segment.set(36);
      rel_segment.set(44);
      rel_path = new BitSet(256);
      rel_path.or(rel_segment);
      rel_path.or(abs_path);
      net_path = new BitSet(256);
      net_path.set(47);
      net_path.or(authority);
      net_path.or(abs_path);
      hier_part = new BitSet(256);
      hier_part.or(net_path);
      hier_part.or(abs_path);
      hier_part.or(query);
      relativeURI = new BitSet(256);
      relativeURI.or(net_path);
      relativeURI.or(abs_path);
      relativeURI.or(rel_path);
      relativeURI.or(query);
      absoluteURI = new BitSet(256);
      absoluteURI.or(scheme);
      absoluteURI.set(58);
      absoluteURI.or(hier_part);
      absoluteURI.or(opaque_part);
      URI_reference = new BitSet(256);
      URI_reference.or(absoluteURI);
      URI_reference.or(relativeURI);
      URI_reference.set(35);
      URI_reference.or(fragment);
      control = new BitSet(256);
      for (int i2 = 0; i2 <= 31; ++i2)
        control.set(i2);
      control.set(127);
      space = new BitSet(256);
      space.set(32);
      delims = new BitSet(256);
      delims.set(60);
      delims.set(62);
      delims.set(35);
      delims.set(37);
      delims.set(34);
      unwise = new BitSet(256);
      unwise.set(123);
      unwise.set(125);
      unwise.set(124);
      unwise.set(92);
      unwise.set(94);
      unwise.set(91);
      unwise.set(93);
      unwise.set(96);
      disallowed_rel_path = new BitSet(256);
      disallowed_rel_path.or(uric);
      disallowed_rel_path.andNot(rel_path);
      disallowed_opaque_part = new BitSet(256);
      disallowed_opaque_part.or(uric);
      disallowed_opaque_part.andNot(opaque_part);
      allowed_authority = new BitSet(256);
      allowed_authority.or(authority);
      allowed_authority.clear(37);
      allowed_opaque_part = new BitSet(256);
      allowed_opaque_part.or(opaque_part);
      allowed_opaque_part.clear(37);
      allowed_reg_name = new BitSet(256);
      allowed_reg_name.or(reg_name);
      allowed_reg_name.clear(37);
      allowed_userinfo = new BitSet(256);
      allowed_userinfo.or(userinfo);
      allowed_userinfo.clear(37);
      allowed_within_userinfo = new BitSet(256);
      allowed_within_userinfo.or(within_userinfo);
      allowed_within_userinfo.clear(37);
      allowed_IPv6reference = new BitSet(256);
      allowed_IPv6reference.or(IPv6reference);
      allowed_IPv6reference.clear(91);
      allowed_IPv6reference.clear(93);
      allowed_host = new BitSet(256);
      allowed_host.or(hostname);
      allowed_host.or(allowed_IPv6reference);
      allowed_within_authority = new BitSet(256);
      allowed_within_authority.or(server);
      allowed_within_authority.or(reg_name);
      allowed_within_authority.clear(59);
      allowed_within_authority.clear(58);
      allowed_within_authority.clear(64);
      allowed_within_authority.clear(63);
      allowed_within_authority.clear(47);
      allowed_abs_path = new BitSet(256);
      allowed_abs_path.or(abs_path);
      allowed_abs_path.andNot(percent);
      allowed_abs_path.clear(43);
      allowed_rel_path = new BitSet(256);
      allowed_rel_path.or(rel_path);
      allowed_rel_path.clear(37);
      allowed_rel_path.clear(43);
      allowed_within_path = new BitSet(256);
      allowed_within_path.or(abs_path);
      allowed_within_path.clear(47);
      allowed_within_path.clear(59);
      allowed_within_path.clear(61);
      allowed_within_path.clear(63);
      allowed_query = new BitSet(256);
      allowed_query.or(uric);
      allowed_query.clear(37);
      allowed_within_query = new BitSet(256);
      allowed_within_query.or(allowed_query);
      allowed_within_query.andNot(reserved);
      allowed_fragment = new BitSet(256);
      allowed_fragment.or(uric);
      allowed_fragment.clear(37);
      return;
    }
    catch (SecurityException localSecurityException)
    {
    }
  }

  protected URI()
  {
    this.hash = 0;
    this._uri = null;
    this.protocolCharset = null;
    this._scheme = null;
    this._opaque = null;
    this._authority = null;
    this._userinfo = null;
    this._host = null;
    this._port = -1;
    this._path = null;
    this._query = null;
    this._fragment = null;
  }

  public URI(String paramString)
    throws URIException
  {
    this.hash = 0;
    this._uri = null;
    this.protocolCharset = null;
    this._scheme = null;
    this._opaque = null;
    this._authority = null;
    this._userinfo = null;
    this._host = null;
    this._port = -1;
    this._path = null;
    this._query = null;
    this._fragment = null;
    parseUriReference(paramString, false);
  }

  public URI(String paramString1, String paramString2)
    throws URIException
  {
    this.hash = 0;
    this._uri = null;
    this.protocolCharset = null;
    this._scheme = null;
    this._opaque = null;
    this._authority = null;
    this._userinfo = null;
    this._host = null;
    this._port = -1;
    this._path = null;
    this._query = null;
    this._fragment = null;
    this.protocolCharset = paramString2;
    parseUriReference(paramString1, false);
  }

  public URI(String paramString1, String paramString2, String paramString3)
    throws URIException
  {
    this.hash = 0;
    this._uri = null;
    this.protocolCharset = null;
    this._scheme = null;
    this._opaque = null;
    this._authority = null;
    this._userinfo = null;
    this._host = null;
    this._port = -1;
    this._path = null;
    this._query = null;
    this._fragment = null;
    if (paramString1 == null)
      throw new URIException(1, "scheme required");
    char[] arrayOfChar1 = paramString1.toLowerCase().toCharArray();
    if (validate(arrayOfChar1, scheme))
    {
      this._scheme = arrayOfChar1;
      this._opaque = encode(paramString2, allowed_opaque_part, getProtocolCharset());
      this._is_opaque_part = true;
      if (paramString3 != null)
        break label158;
    }
    for (char[] arrayOfChar2 = null; ; arrayOfChar2 = paramString3.toCharArray())
    {
      this._fragment = arrayOfChar2;
      setURI();
      return;
      label158: throw new URIException(1, "incorrect scheme");
    }
  }

  public URI(String paramString1, String paramString2, String paramString3, int paramInt)
    throws URIException
  {
    this(paramString1, paramString2, paramString3, paramInt, null, null, null);
  }

  public URI(String paramString1, String paramString2, String paramString3, int paramInt, String paramString4)
    throws URIException
  {
    this(paramString1, paramString2, paramString3, paramInt, paramString4, null, null);
  }

  public URI(String paramString1, String paramString2, String paramString3, int paramInt, String paramString4, String paramString5)
    throws URIException
  {
    this(paramString1, paramString2, paramString3, paramInt, paramString4, paramString5, null);
  }

  public URI(String paramString1, String paramString2, String paramString3, int paramInt, String paramString4, String paramString5, String paramString6)
    throws URIException
  {
  }

  public URI(String paramString1, String paramString2, String paramString3, String paramString4)
    throws URIException
  {
    this(paramString1, paramString2, paramString3, null, paramString4);
  }

  public URI(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5)
    throws URIException
  {
    this.hash = 0;
    this._uri = null;
    this.protocolCharset = null;
    this._scheme = null;
    this._opaque = null;
    this._authority = null;
    this._userinfo = null;
    this._host = null;
    this._port = -1;
    this._path = null;
    this._query = null;
    this._fragment = null;
    StringBuffer localStringBuffer = new StringBuffer();
    if (paramString1 != null)
    {
      localStringBuffer.append(paramString1);
      localStringBuffer.append(':');
    }
    if (paramString2 != null)
    {
      localStringBuffer.append("//");
      localStringBuffer.append(paramString2);
    }
    if (paramString3 != null)
    {
      if ((((paramString1 != null) || (paramString2 != null))) && (!(paramString3.startsWith("/"))))
        throw new URIException(1, "abs_path requested");
      localStringBuffer.append(paramString3);
    }
    if (paramString4 != null)
    {
      localStringBuffer.append('?');
      localStringBuffer.append(paramString4);
    }
    if (paramString5 != null)
    {
      localStringBuffer.append('#');
      localStringBuffer.append(paramString5);
    }
    parseUriReference(localStringBuffer.toString(), false);
  }

  public URI(String paramString, boolean paramBoolean)
    throws URIException, NullPointerException
  {
    this.hash = 0;
    this._uri = null;
    this.protocolCharset = null;
    this._scheme = null;
    this._opaque = null;
    this._authority = null;
    this._userinfo = null;
    this._host = null;
    this._port = -1;
    this._path = null;
    this._query = null;
    this._fragment = null;
    parseUriReference(paramString, paramBoolean);
  }

  public URI(String paramString1, boolean paramBoolean, String paramString2)
    throws URIException, NullPointerException
  {
    this.hash = 0;
    this._uri = null;
    this.protocolCharset = null;
    this._scheme = null;
    this._opaque = null;
    this._authority = null;
    this._userinfo = null;
    this._host = null;
    this._port = -1;
    this._path = null;
    this._query = null;
    this._fragment = null;
    this.protocolCharset = paramString2;
    parseUriReference(paramString1, paramBoolean);
  }

  public URI(URI paramURI, String paramString)
    throws URIException
  {
    this(paramURI, new URI(paramString));
  }

  public URI(URI paramURI, String paramString, boolean paramBoolean)
    throws URIException
  {
    this(paramURI, new URI(paramString, paramBoolean));
  }

  public URI(URI paramURI1, URI paramURI2)
    throws URIException
  {
    this.hash = 0;
    this._uri = null;
    this.protocolCharset = null;
    this._scheme = null;
    this._opaque = null;
    this._authority = null;
    this._userinfo = null;
    this._host = null;
    this._port = -1;
    this._path = null;
    this._query = null;
    this._fragment = null;
    if (paramURI1._scheme == null)
      throw new URIException(1, "base URI required");
    if (paramURI1._scheme != null)
    {
      this._scheme = paramURI1._scheme;
      this._authority = paramURI1._authority;
      this._is_net_path = paramURI1._is_net_path;
    }
    if ((paramURI1._is_opaque_part) || (paramURI2._is_opaque_part))
    {
      this._scheme = paramURI1._scheme;
      if ((paramURI1._is_opaque_part) || (paramURI2._is_opaque_part));
      for (int i = 1; ; i = 0)
      {
        this._is_opaque_part = i;
        this._opaque = paramURI2._opaque;
        this._fragment = paramURI2._fragment;
        setURI();
        label178: return;
      }
    }
    boolean bool = Arrays.equals(paramURI1._scheme, paramURI2._scheme);
    if ((paramURI2._scheme != null) && (((!(bool)) || (paramURI2._authority != null))))
    {
      this._scheme = paramURI2._scheme;
      this._is_net_path = paramURI2._is_net_path;
      this._authority = paramURI2._authority;
      if (paramURI2._is_server)
      {
        this._is_server = paramURI2._is_server;
        this._userinfo = paramURI2._userinfo;
        this._host = paramURI2._host;
        this._port = paramURI2._port;
        label279: this._is_abs_path = paramURI2._is_abs_path;
        this._is_rel_path = paramURI2._is_rel_path;
        this._path = paramURI2._path;
        if (paramURI2._authority != null)
        {
          label303: this._is_net_path = paramURI2._is_net_path;
          this._authority = paramURI2._authority;
          if (!(paramURI2._is_server))
            break label607;
          this._is_server = paramURI2._is_server;
          this._userinfo = paramURI2._userinfo;
          this._host = paramURI2._host;
          this._port = paramURI2._port;
          label365: this._is_abs_path = paramURI2._is_abs_path;
          this._is_rel_path = paramURI2._is_rel_path;
          this._path = paramURI2._path;
        }
        if ((paramURI2._authority == null) && (((paramURI2._scheme == null) || (bool))))
        {
          if (((paramURI2._path != null) && (paramURI2._path.length != 0)) || (paramURI2._query != null))
            break label625;
          this._path = paramURI1._path;
          this._query = paramURI1._query;
        }
      }
    }
    while (true)
    {
      if (paramURI2._query != null)
        this._query = paramURI2._query;
      if (paramURI2._fragment != null)
        this._fragment = paramURI2._fragment;
      setURI();
      parseUriReference(new String(this._uri), true);
      break label178:
      if (paramURI2._is_reg_name);
      this._is_reg_name = paramURI2._is_reg_name;
      break label279:
      if ((paramURI1._authority != null) && (paramURI2._scheme == null));
      this._is_net_path = paramURI1._is_net_path;
      this._authority = paramURI1._authority;
      if (paramURI1._is_server)
      {
        this._is_server = paramURI1._is_server;
        this._userinfo = paramURI1._userinfo;
        this._host = paramURI1._host;
        this._port = paramURI1._port;
      }
      if (paramURI1._is_reg_name);
      this._is_reg_name = paramURI1._is_reg_name;
      break label303:
      label607: if (paramURI2._is_reg_name);
      this._is_reg_name = paramURI2._is_reg_name;
      break label365:
      label625: this._path = resolvePath(paramURI1._path, paramURI2._path);
    }
  }

  public URI(char[] paramArrayOfChar)
    throws URIException, NullPointerException
  {
    this.hash = 0;
    this._uri = null;
    this.protocolCharset = null;
    this._scheme = null;
    this._opaque = null;
    this._authority = null;
    this._userinfo = null;
    this._host = null;
    this._port = -1;
    this._path = null;
    this._query = null;
    this._fragment = null;
    parseUriReference(new String(paramArrayOfChar), true);
  }

  public URI(char[] paramArrayOfChar, String paramString)
    throws URIException, NullPointerException
  {
    this.hash = 0;
    this._uri = null;
    this.protocolCharset = null;
    this._scheme = null;
    this._opaque = null;
    this._authority = null;
    this._userinfo = null;
    this._host = null;
    this._port = -1;
    this._path = null;
    this._query = null;
    this._fragment = null;
    this.protocolCharset = paramString;
    parseUriReference(new String(paramArrayOfChar), true);
  }

  protected static String decode(String paramString1, String paramString2)
    throws URIException
  {
    if (paramString1 == null)
      throw new IllegalArgumentException("Component array of chars may not be null");
    try
    {
      byte[] arrayOfByte = URLCodec.decodeUrl(EncodingUtil.getAsciiBytes(paramString1));
      return EncodingUtil.getString(arrayOfByte, paramString2);
    }
    catch (DecoderException localDecoderException)
    {
      throw new URIException(localDecoderException.getMessage());
    }
  }

  protected static String decode(char[] paramArrayOfChar, String paramString)
    throws URIException
  {
    if (paramArrayOfChar == null)
      throw new IllegalArgumentException("Component array of chars may not be null");
    return decode(new String(paramArrayOfChar), paramString);
  }

  protected static char[] encode(String paramString1, BitSet paramBitSet, String paramString2)
    throws URIException
  {
    if (paramString1 == null)
      throw new IllegalArgumentException("Original string may not be null");
    if (paramBitSet == null)
      throw new IllegalArgumentException("Allowed bitset may not be null");
    return EncodingUtil.getAsciiString(URLCodec.encodeUrl(paramBitSet, EncodingUtil.getBytes(paramString1, paramString2))).toCharArray();
  }

  public static String getDefaultDocumentCharset()
  {
    return defaultDocumentCharset;
  }

  public static String getDefaultDocumentCharsetByLocale()
  {
    return defaultDocumentCharsetByLocale;
  }

  public static String getDefaultDocumentCharsetByPlatform()
  {
    return defaultDocumentCharsetByPlatform;
  }

  public static String getDefaultProtocolCharset()
  {
    return defaultProtocolCharset;
  }

  private void readObject(ObjectInputStream paramObjectInputStream)
    throws ClassNotFoundException, IOException
  {
    paramObjectInputStream.defaultReadObject();
  }

  public static void setDefaultDocumentCharset(String paramString)
    throws URI.DefaultCharsetChanged
  {
    defaultDocumentCharset = paramString;
    throw new URI.DefaultCharsetChanged(2, "the default document charset changed");
  }

  public static void setDefaultProtocolCharset(String paramString)
    throws URI.DefaultCharsetChanged
  {
    defaultProtocolCharset = paramString;
    throw new URI.DefaultCharsetChanged(1, "the default protocol charset changed");
  }

  private void writeObject(ObjectOutputStream paramObjectOutputStream)
    throws IOException
  {
    paramObjectOutputStream.defaultWriteObject();
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    monitorenter;
    try
    {
      URI localURI = (URI)super.clone();
      localURI._uri = this._uri;
      localURI._scheme = this._scheme;
      localURI._opaque = this._opaque;
      localURI._authority = this._authority;
      localURI._userinfo = this._userinfo;
      localURI._host = this._host;
      localURI._port = this._port;
      localURI._path = this._path;
      localURI._query = this._query;
      localURI._fragment = this._fragment;
      localURI.protocolCharset = this.protocolCharset;
      localURI._is_hier_part = this._is_hier_part;
      localURI._is_opaque_part = this._is_opaque_part;
      localURI._is_net_path = this._is_net_path;
      localURI._is_abs_path = this._is_abs_path;
      localURI._is_rel_path = this._is_rel_path;
      localURI._is_reg_name = this._is_reg_name;
      localURI._is_server = this._is_server;
      localURI._is_hostname = this._is_hostname;
      localURI._is_IPv4address = this._is_IPv4address;
      localURI._is_IPv6reference = this._is_IPv6reference;
      monitorexit;
      return localURI;
    }
    finally
    {
      localObject = finally;
      monitorexit;
      throw localObject;
    }
  }

  public int compareTo(Object paramObject)
    throws ClassCastException
  {
    URI localURI = (URI)paramObject;
    if (!(equals(this._authority, localURI.getRawAuthority())));
    for (int i = -1; ; i = toString().compareTo(localURI.toString()))
      return i;
  }

  public boolean equals(Object paramObject)
  {
    if (paramObject == this);
    for (int i = 1; ; i = 1)
      while (true)
      {
        return i;
        if (!(paramObject instanceof URI))
          i = 0;
        URI localURI = (URI)paramObject;
        if (!(equals(this._scheme, localURI._scheme)))
          i = 0;
        if (!(equals(this._opaque, localURI._opaque)))
          i = 0;
        if (!(equals(this._authority, localURI._authority)))
          i = 0;
        if (!(equals(this._path, localURI._path)))
          i = 0;
        if (!(equals(this._query, localURI._query)))
          i = 0;
        if (equals(this._fragment, localURI._fragment))
          break;
        i = 0;
      }
  }

  protected boolean equals(char[] paramArrayOfChar1, char[] paramArrayOfChar2)
  {
    if ((paramArrayOfChar1 == null) && (paramArrayOfChar2 == null));
    for (int i = 1; ; i = 1)
    {
      while (true)
      {
        label10: return i;
        if ((paramArrayOfChar1 == null) || (paramArrayOfChar2 == null))
          i = 0;
        if (paramArrayOfChar1.length == paramArrayOfChar2.length)
          break;
        i = 0;
      }
      for (int j = 0; j < paramArrayOfChar1.length; ++j)
      {
        if (paramArrayOfChar1[j] == paramArrayOfChar2[j])
          continue;
        i = 0;
        break label10:
      }
    }
  }

  public String getAboveHierPath()
    throws URIException
  {
    char[] arrayOfChar = getRawAboveHierPath();
    if (arrayOfChar == null);
    for (String str = null; ; str = decode(arrayOfChar, getProtocolCharset()))
      return str;
  }

  public String getAuthority()
    throws URIException
  {
    if (this._authority == null);
    for (String str = null; ; str = decode(this._authority, getProtocolCharset()))
      return str;
  }

  public String getCurrentHierPath()
    throws URIException
  {
    char[] arrayOfChar = getRawCurrentHierPath();
    if (arrayOfChar == null);
    for (String str = null; ; str = decode(arrayOfChar, getProtocolCharset()))
      return str;
  }

  public String getEscapedAboveHierPath()
    throws URIException
  {
    char[] arrayOfChar = getRawAboveHierPath();
    if (arrayOfChar == null);
    for (String str = null; ; str = new String(arrayOfChar))
      return str;
  }

  public String getEscapedAuthority()
  {
    if (this._authority == null);
    for (String str = null; ; str = new String(this._authority))
      return str;
  }

  public String getEscapedCurrentHierPath()
    throws URIException
  {
    char[] arrayOfChar = getRawCurrentHierPath();
    if (arrayOfChar == null);
    for (String str = null; ; str = new String(arrayOfChar))
      return str;
  }

  public String getEscapedFragment()
  {
    if (this._fragment == null);
    for (String str = null; ; str = new String(this._fragment))
      return str;
  }

  public String getEscapedName()
  {
    char[] arrayOfChar = getRawName();
    if (arrayOfChar == null);
    for (String str = null; ; str = new String(arrayOfChar))
      return str;
  }

  public String getEscapedPath()
  {
    char[] arrayOfChar = getRawPath();
    if (arrayOfChar == null);
    for (String str = null; ; str = new String(arrayOfChar))
      return str;
  }

  public String getEscapedPathQuery()
  {
    char[] arrayOfChar = getRawPathQuery();
    if (arrayOfChar == null);
    for (String str = null; ; str = new String(arrayOfChar))
      return str;
  }

  public String getEscapedQuery()
  {
    if (this._query == null);
    for (String str = null; ; str = new String(this._query))
      return str;
  }

  public String getEscapedURI()
  {
    if (this._uri == null);
    for (String str = null; ; str = new String(this._uri))
      return str;
  }

  public String getEscapedURIReference()
  {
    char[] arrayOfChar = getRawURIReference();
    if (arrayOfChar == null);
    for (String str = null; ; str = new String(arrayOfChar))
      return str;
  }

  public String getEscapedUserinfo()
  {
    if (this._userinfo == null);
    for (String str = null; ; str = new String(this._userinfo))
      return str;
  }

  public String getFragment()
    throws URIException
  {
    if (this._fragment == null);
    for (String str = null; ; str = decode(this._fragment, getProtocolCharset()))
      return str;
  }

  public String getHost()
    throws URIException
  {
    if (this._host != null);
    for (String str = decode(this._host, getProtocolCharset()); ; str = null)
      return str;
  }

  public String getName()
    throws URIException
  {
    if (getRawName() == null);
    for (String str = null; ; str = decode(getRawName(), getProtocolCharset()))
      return str;
  }

  public String getPath()
    throws URIException
  {
    char[] arrayOfChar = getRawPath();
    if (arrayOfChar == null);
    for (String str = null; ; str = decode(arrayOfChar, getProtocolCharset()))
      return str;
  }

  public String getPathQuery()
    throws URIException
  {
    char[] arrayOfChar = getRawPathQuery();
    if (arrayOfChar == null);
    for (String str = null; ; str = decode(arrayOfChar, getProtocolCharset()))
      return str;
  }

  public int getPort()
  {
    return this._port;
  }

  public String getProtocolCharset()
  {
    if (this.protocolCharset != null);
    for (String str = this.protocolCharset; ; str = defaultProtocolCharset)
      return str;
  }

  public String getQuery()
    throws URIException
  {
    if (this._query == null);
    for (String str = null; ; str = decode(this._query, getProtocolCharset()))
      return str;
  }

  public char[] getRawAboveHierPath()
    throws URIException
  {
    char[] arrayOfChar1 = getRawCurrentHierPath();
    if (arrayOfChar1 == null);
    for (char[] arrayOfChar2 = null; ; arrayOfChar2 = getRawCurrentHierPath(arrayOfChar1))
      return arrayOfChar2;
  }

  public char[] getRawAuthority()
  {
    return this._authority;
  }

  public char[] getRawCurrentHierPath()
    throws URIException
  {
    if (this._path == null);
    for (char[] arrayOfChar = null; ; arrayOfChar = getRawCurrentHierPath(this._path))
      return arrayOfChar;
  }

  protected char[] getRawCurrentHierPath(char[] paramArrayOfChar)
    throws URIException
  {
    if (this._is_opaque_part)
      throw new URIException(1, "no hierarchy level");
    if (paramArrayOfChar == null)
      throw new URIException(1, "empty path");
    String str = new String(paramArrayOfChar);
    int i = str.indexOf(47);
    int j = str.lastIndexOf(47);
    if (j == 0);
    for (char[] arrayOfChar = rootPath; ; arrayOfChar = paramArrayOfChar)
      while (true)
      {
        return arrayOfChar;
        if ((i == j) || (j == -1))
          break;
        arrayOfChar = str.substring(0, j).toCharArray();
      }
  }

  public char[] getRawFragment()
  {
    return this._fragment;
  }

  public char[] getRawHost()
  {
    return this._host;
  }

  public char[] getRawName()
  {
    Object localObject;
    if (this._path == null)
    {
      localObject = null;
      label10: return localObject;
    }
    int i = 0;
    for (int j = this._path.length - 1; ; --j)
    {
      if (j >= 0)
      {
        if (this._path[j] != '/')
          continue;
        i = j + 1;
      }
      int k = this._path.length - i;
      char[] arrayOfChar = new char[k];
      System.arraycopy(this._path, i, arrayOfChar, 0, k);
      localObject = arrayOfChar;
      break label10:
    }
  }

  public char[] getRawPath()
  {
    if (this._is_opaque_part);
    for (char[] arrayOfChar = this._opaque; ; arrayOfChar = this._path)
      return arrayOfChar;
  }

  public char[] getRawPathQuery()
  {
    if ((this._path == null) && (this._query == null));
    StringBuffer localStringBuffer;
    for (char[] arrayOfChar = null; ; arrayOfChar = localStringBuffer.toString().toCharArray())
    {
      return arrayOfChar;
      localStringBuffer = new StringBuffer();
      if (this._path != null)
        localStringBuffer.append(this._path);
      if (this._query == null)
        continue;
      localStringBuffer.append('?');
      localStringBuffer.append(this._query);
    }
  }

  public char[] getRawQuery()
  {
    return this._query;
  }

  public char[] getRawScheme()
  {
    return this._scheme;
  }

  public char[] getRawURI()
  {
    return this._uri;
  }

  public char[] getRawURIReference()
  {
    if (this._fragment == null);
    for (char[] arrayOfChar = this._uri; ; arrayOfChar = new String(this._uri) + "#" + new String(this._fragment).toCharArray())
      while (true)
      {
        return arrayOfChar;
        if (this._uri != null)
          break;
        arrayOfChar = this._fragment;
      }
  }

  public char[] getRawUserinfo()
  {
    return this._userinfo;
  }

  public String getScheme()
  {
    if (this._scheme == null);
    for (String str = null; ; str = new String(this._scheme))
      return str;
  }

  public String getURI()
    throws URIException
  {
    if (this._uri == null);
    for (String str = null; ; str = decode(this._uri, getProtocolCharset()))
      return str;
  }

  public String getURIReference()
    throws URIException
  {
    char[] arrayOfChar = getRawURIReference();
    if (arrayOfChar == null);
    for (String str = null; ; str = decode(arrayOfChar, getProtocolCharset()))
      return str;
  }

  public String getUserinfo()
    throws URIException
  {
    if (this._userinfo == null);
    for (String str = null; ; str = decode(this._userinfo, getProtocolCharset()))
      return str;
  }

  public boolean hasAuthority()
  {
    if ((this._authority != null) || (this._is_net_path));
    for (int i = 1; ; i = 0)
      return i;
  }

  public boolean hasFragment()
  {
    if (this._fragment != null);
    for (int i = 1; ; i = 0)
      return i;
  }

  public boolean hasQuery()
  {
    if (this._query != null);
    for (int i = 1; ; i = 0)
      return i;
  }

  public boolean hasUserinfo()
  {
    if (this._userinfo != null);
    for (int i = 1; ; i = 0)
      return i;
  }

  public int hashCode()
  {
    if (this.hash == 0)
    {
      char[] arrayOfChar1 = this._uri;
      if (arrayOfChar1 != null)
      {
        int k = 0;
        int l = arrayOfChar1.length;
        while (k < l)
        {
          this.hash = (31 * this.hash + arrayOfChar1[k]);
          ++k;
        }
      }
      char[] arrayOfChar2 = this._fragment;
      if (arrayOfChar2 != null)
      {
        int i = 0;
        int j = arrayOfChar2.length;
        while (i < j)
        {
          this.hash = (31 * this.hash + arrayOfChar2[i]);
          ++i;
        }
      }
    }
    return this.hash;
  }

  protected int indexFirstOf(String paramString1, String paramString2)
  {
    return indexFirstOf(paramString1, paramString2, -1);
  }

  protected int indexFirstOf(String paramString1, String paramString2, int paramInt)
  {
    if ((paramString1 == null) || (paramString1.length() == 0));
    int j;
    for (int i = -1; ; i = j)
      while (true)
      {
        return i;
        if ((paramString2 == null) || (paramString2.length() == 0))
          i = -1;
        if (paramInt < 0)
          paramInt = 0;
        do
        {
          j = paramString1.length();
          char[] arrayOfChar = paramString2.toCharArray();
          for (int k = 0; ; ++k)
          {
            if (k >= arrayOfChar.length)
              break label114;
            int l = paramString1.indexOf(arrayOfChar[k], paramInt);
            if ((l < 0) || (l >= j))
              continue;
            j = l;
          }
        }
        while (paramInt <= paramString1.length());
        i = -1;
        continue;
        label114: if (j != paramString1.length())
          break;
        i = -1;
      }
  }

  protected int indexFirstOf(char[] paramArrayOfChar, char paramChar)
  {
    return indexFirstOf(paramArrayOfChar, paramChar, 0);
  }

  protected int indexFirstOf(char[] paramArrayOfChar, char paramChar, int paramInt)
  {
    if ((paramArrayOfChar == null) || (paramArrayOfChar.length == 0));
    for (int i = -1; ; i = -1)
    {
      label13: return i;
      if (paramInt < 0)
        paramInt = 0;
      for (int j = paramInt; j < paramArrayOfChar.length; ++j)
      {
        if (paramArrayOfChar[j] != paramChar)
          continue;
        i = j;
        break label13:
        if (paramInt > paramArrayOfChar.length);
        i = -1;
        break label13:
      }
    }
  }

  public boolean isAbsPath()
  {
    return this._is_abs_path;
  }

  public boolean isAbsoluteURI()
  {
    if (this._scheme != null);
    for (int i = 1; ; i = 0)
      return i;
  }

  public boolean isHierPart()
  {
    return this._is_hier_part;
  }

  public boolean isHostname()
  {
    return this._is_hostname;
  }

  public boolean isIPv4address()
  {
    return this._is_IPv4address;
  }

  public boolean isIPv6reference()
  {
    return this._is_IPv6reference;
  }

  public boolean isNetPath()
  {
    if ((this._is_net_path) || (this._authority != null));
    for (int i = 1; ; i = 0)
      return i;
  }

  public boolean isOpaquePart()
  {
    return this._is_opaque_part;
  }

  public boolean isRegName()
  {
    return this._is_reg_name;
  }

  public boolean isRelPath()
  {
    return this._is_rel_path;
  }

  public boolean isRelativeURI()
  {
    if (this._scheme == null);
    for (int i = 1; ; i = 0)
      return i;
  }

  public boolean isServer()
  {
    return this._is_server;
  }

  public void normalize()
    throws URIException
  {
    if (!(isAbsPath()))
      return;
    this._path = normalize(this._path);
    setURI();
  }

  protected char[] normalize(char[] paramArrayOfChar)
    throws URIException
  {
    char[] arrayOfChar;
    if (paramArrayOfChar == null)
    {
      arrayOfChar = null;
      label7: return arrayOfChar;
    }
    String str = new String(paramArrayOfChar);
    if (str.startsWith("./"));
    for (str = str.substring(1); ; str = str.substring(2))
      do
        while (true)
        {
          int i = str.indexOf("/./");
          if (i == -1)
            break label120;
          str = str.substring(0, i) + str.substring(i + 2);
          continue;
          if (!(str.startsWith("../")))
            break;
          str = str.substring(2);
        }
      while (!(str.startsWith("..")));
    if (str.endsWith("/."))
      label120: str = str.substring(0, str.length() - 1);
    int k;
    for (int j = 0; ; j = k + 3)
      while (true)
      {
        k = str.indexOf("/../", j);
        if (k == -1)
          break label224;
        int i2 = str.lastIndexOf(47, k - 1);
        if (i2 < 0)
          break;
        str = str.substring(0, i2) + str.substring(k + 3);
      }
    label224: int i1;
    if (str.endsWith("/.."))
    {
      i1 = str.lastIndexOf(47, str.length() - 4);
      if (i1 < 0);
    }
    int l;
    for (str = str.substring(0, i1 + 1); ; str = str.substring(l + 3))
    {
      l = str.indexOf("/../");
      if ((l != -1) && (str.lastIndexOf(47, l - 1) < 0))
        continue;
      if ((str.endsWith("/..")) && (str.lastIndexOf(47, str.length() - 4) < 0))
        str = "/";
      arrayOfChar = str.toCharArray();
      break label7:
    }
  }

  protected void parseAuthority(String paramString, boolean paramBoolean)
    throws URIException
  {
    this._is_IPv6reference = false;
    this._is_IPv4address = false;
    this._is_hostname = false;
    this._is_server = false;
    this._is_reg_name = false;
    String str = getProtocolCharset();
    int i = 1;
    int j = 0;
    int k = paramString.indexOf(64);
    if (k != -1)
      if (!(paramBoolean))
        break label121;
    int i2;
    for (char[] arrayOfChar2 = paramString.substring(0, k).toCharArray(); ; arrayOfChar2 = encode(paramString.substring(0, k), allowed_userinfo, str))
    {
      this._userinfo = arrayOfChar2;
      j = k + 1;
      if (paramString.indexOf(91, j) < j)
        break label258;
      i2 = paramString.indexOf(93, j);
      if (i2 != -1)
        break;
      label121: throw new URIException(1, "IPv6reference");
    }
    int l = i2 + 1;
    char[] arrayOfChar1;
    if (paramBoolean)
    {
      arrayOfChar1 = paramString.substring(j, l).toCharArray();
      label163: this._host = arrayOfChar1;
      this._is_IPv6reference = true;
    }
    while (true)
    {
      if (!(this._is_reg_name))
        break label364;
      this._is_IPv6reference = false;
      this._is_IPv4address = false;
      this._is_hostname = false;
      this._is_server = false;
      if (!(paramBoolean))
        break;
      this._authority = paramString.toCharArray();
      if (validate(this._authority, reg_name))
        break label363;
      throw new URIException("Invalid authority");
      arrayOfChar1 = encode(paramString.substring(j, l), allowed_IPv6reference, str);
      break label163:
      label258: l = paramString.indexOf(58, j);
      if (l == -1)
      {
        l = paramString.length();
        i = 0;
      }
      this._host = paramString.substring(j, l).toCharArray();
      if (validate(this._host, IPv4address))
        this._is_IPv4address = true;
      if (validate(this._host, hostname))
        this._is_hostname = true;
      this._is_reg_name = true;
    }
    this._authority = encode(paramString, allowed_reg_name, str);
    while (true)
    {
      label363: return;
      label364: int i1;
      if ((paramString.length() - 1 > l) && (i != 0) && (paramString.charAt(l) == ':'))
        i1 = l + 1;
      try
      {
        this._port = Integer.parseInt(paramString.substring(i1));
        StringBuffer localStringBuffer = new StringBuffer();
        if (this._userinfo != null)
        {
          localStringBuffer.append(this._userinfo);
          localStringBuffer.append('@');
        }
        if (this._host != null)
        {
          localStringBuffer.append(this._host);
          if (this._port != -1)
          {
            localStringBuffer.append(':');
            localStringBuffer.append(this._port);
          }
        }
        this._authority = localStringBuffer.toString().toCharArray();
        this._is_server = true;
      }
      catch (NumberFormatException localNumberFormatException)
      {
        throw new URIException(1, "invalid port number");
      }
    }
  }

  protected void parseUriReference(String paramString, boolean paramBoolean)
    throws URIException
  {
    if (paramString == null)
      throw new URIException("URI-Reference required");
    String str1 = paramString.trim();
    int i = str1.length();
    if (i > 0)
    {
      char[] arrayOfChar3 = new char[1];
      arrayOfChar3[0] = str1.charAt(0);
      if ((validate(arrayOfChar3, delims)) && (i >= 2))
      {
        char[] arrayOfChar4 = new char[1];
        int i10 = i - 1;
        arrayOfChar4[0] = str1.charAt(i10);
        if (validate(arrayOfChar4, delims))
        {
          str1 = str1.substring(1, i - 1);
          i -= 2;
        }
      }
    }
    int j = 0;
    int k = 0;
    int l = str1.indexOf(58);
    int i1 = str1.indexOf(47);
    if (((l <= 0) && (!(str1.startsWith("//")))) || ((i1 >= 0) && (i1 < l)))
      k = 1;
    String str2;
    label171: int i8;
    label374: int i6;
    label509: String str4;
    if (k != 0)
    {
      str2 = "/?#";
      i2 = indexFirstOf(str1, str2, 0);
      if (i2 == -1)
        i2 = 0;
      if ((i2 > 0) && (i2 < i) && (str1.charAt(i2) == ':'))
      {
        char[] arrayOfChar2 = str1.substring(0, i2).toLowerCase().toCharArray();
        if (!(validate(arrayOfChar2, scheme)))
          break label650;
        this._scheme = arrayOfChar2;
        j = ++i2;
      }
      this._is_hier_part = false;
      this._is_rel_path = false;
      this._is_abs_path = false;
      this._is_net_path = false;
      if ((i2 >= 0) && (i2 < i) && (str1.charAt(i2) == '/'))
      {
        this._is_hier_part = true;
        if ((i2 + 2 < i) && (str1.charAt(i2 + 1) == '/') && (k == 0))
        {
          int i7 = i2 + 2;
          i8 = indexFirstOf(str1, "/?#", i7);
          if (i8 == -1)
          {
            if (str1.substring(i2 + 2).length() != 0)
              break label661;
            i8 = i2 + 2;
          }
          int i9 = i2 + 2;
          parseAuthority(str1.substring(i9, i8), paramBoolean);
          i2 = i8;
          j = i8;
          this._is_net_path = true;
        }
        if (j == i2)
          this._is_abs_path = true;
      }
      if (j < i)
      {
        i6 = indexFirstOf(str1, "?#", j);
        if (i6 == -1)
          i6 = str1.length();
        if (!(this._is_abs_path))
        {
          if ((((paramBoolean) || (!(prevalidate(str1.substring(j, i6), disallowed_rel_path))))) && (((!(paramBoolean)) || (!(validate(str1.substring(j, i6).toCharArray(), rel_path))))))
            break label670;
          this._is_rel_path = true;
        }
        str4 = str1.substring(j, i6);
        if (!(paramBoolean))
          break label733;
        setRawPath(str4.toCharArray());
      }
    }
    String str3;
    int i3;
    while (true)
    {
      i2 = i6;
      str3 = getProtocolCharset();
      if ((i2 < 0) || (i2 + 1 >= i) || (str1.charAt(i2) != '?'))
        break label772;
      i3 = str1.indexOf(35, i2 + 1);
      if (i3 == -1)
        i3 = str1.length();
      if (!(paramBoolean))
        break;
      int i5 = i2 + 1;
      this._query = str1.substring(i5, i3).toCharArray();
      if (validate(this._query, uric))
        break label768;
      throw new URIException("Invalid query");
      str2 = ":/?#";
      break label171:
      label650: throw new URIException("incorrect scheme");
      label661: i8 = str1.length();
      break label374:
      if (((!(paramBoolean)) && (prevalidate(str1.substring(j, i6), disallowed_opaque_part))) || ((paramBoolean) && (validate(str1.substring(j, i6).toCharArray(), opaque_part))))
        label670: this._is_opaque_part = true;
      this._path = null;
      break label509:
      label733: setPath(str4);
    }
    int i4 = i2 + 1;
    this._query = encode(str1.substring(i4, i3), allowed_query, str3);
    label768: int i2 = i3;
    if ((i2 >= 0) && (i2 + 1 <= i) && (str1.charAt(i2) == '#'))
    {
      label772: if (i2 + 1 != i)
        break label821;
      this._fragment = "".toCharArray();
    }
    label816: setURI();
    return;
    label821: if (paramBoolean);
    for (char[] arrayOfChar1 = str1.substring(i2 + 1).toCharArray(); ; arrayOfChar1 = encode(str1.substring(i2 + 1), allowed_fragment, str3))
    {
      this._fragment = arrayOfChar1;
      break label816:
    }
  }

  protected boolean prevalidate(String paramString, BitSet paramBitSet)
  {
    if (paramString == null);
    for (int j = 0; ; j = 1)
    {
      label7: return j;
      char[] arrayOfChar = paramString.toCharArray();
      for (int i = 0; i < arrayOfChar.length; ++i)
      {
        if (!(paramBitSet.get(arrayOfChar[i])))
          continue;
        j = 0;
        break label7:
      }
    }
  }

  protected char[] removeFragmentIdentifier(char[] paramArrayOfChar)
  {
    if (paramArrayOfChar == null);
    for (char[] arrayOfChar = null; ; arrayOfChar = paramArrayOfChar)
    {
      return arrayOfChar;
      int i = new String(paramArrayOfChar).indexOf(35);
      if (i == -1)
        continue;
      paramArrayOfChar = new String(paramArrayOfChar).substring(0, i).toCharArray();
    }
  }

  protected char[] resolvePath(char[] paramArrayOfChar1, char[] paramArrayOfChar2)
    throws URIException
  {
    String str1;
    if (paramArrayOfChar1 == null)
    {
      str1 = "";
      label8: if ((paramArrayOfChar2 != null) && (paramArrayOfChar2.length != 0))
        break label39;
    }
    for (char[] arrayOfChar = normalize(paramArrayOfChar1); ; arrayOfChar = normalize(paramArrayOfChar2))
    {
      label24: return arrayOfChar;
      str1 = new String(paramArrayOfChar1);
      break label8:
      label39: if (paramArrayOfChar2[0] != '/')
        break;
    }
    int i = str1.lastIndexOf(47);
    if (i != -1)
      str1.substring(0, i + 1).toCharArray();
    StringBuffer localStringBuffer = new StringBuffer(str1.length() + paramArrayOfChar2.length);
    if (i != -1);
    for (String str2 = str1.substring(0, i + 1); ; str2 = "/")
    {
      localStringBuffer.append(str2);
      localStringBuffer.append(paramArrayOfChar2);
      arrayOfChar = normalize(localStringBuffer.toString().toCharArray());
      break label24:
    }
  }

  public void setEscapedAuthority(String paramString)
    throws URIException
  {
    parseAuthority(paramString, true);
    setURI();
  }

  public void setEscapedFragment(String paramString)
    throws URIException
  {
    if (paramString == null)
    {
      this._fragment = null;
      this.hash = 0;
    }
    while (true)
    {
      return;
      setRawFragment(paramString.toCharArray());
    }
  }

  public void setEscapedPath(String paramString)
    throws URIException
  {
    if (paramString == null)
    {
      this._opaque = null;
      this._path = null;
      setURI();
    }
    while (true)
    {
      return;
      setRawPath(paramString.toCharArray());
    }
  }

  public void setEscapedQuery(String paramString)
    throws URIException
  {
    if (paramString == null)
    {
      this._query = null;
      setURI();
    }
    while (true)
    {
      return;
      setRawQuery(paramString.toCharArray());
    }
  }

  public void setFragment(String paramString)
    throws URIException
  {
    char[] arrayOfChar;
    if ((paramString == null) || (paramString.length() == 0))
      if (paramString == null)
      {
        arrayOfChar = null;
        label17: this._fragment = arrayOfChar;
      }
    for (this.hash = 0; ; this.hash = 0)
    {
      return;
      arrayOfChar = paramString.toCharArray();
      break label17:
      this._fragment = encode(paramString, allowed_fragment, getProtocolCharset());
    }
  }

  public void setPath(String paramString)
    throws URIException
  {
    if ((paramString == null) || (paramString.length() == 0))
    {
      if (paramString == null);
      for (char[] arrayOfChar = null; ; arrayOfChar = paramString.toCharArray())
      {
        this._opaque = arrayOfChar;
        this._path = arrayOfChar;
        setURI();
        label31: return;
      }
    }
    String str = getProtocolCharset();
    if ((this._is_net_path) || (this._is_abs_path))
      this._path = encode(paramString, allowed_abs_path, str);
    while (true)
    {
      label71: setURI();
      break label31:
      if (this._is_rel_path)
      {
        StringBuffer localStringBuffer1 = new StringBuffer(paramString.length());
        int i = paramString.indexOf(47);
        if (i == 0)
          throw new URIException(1, "incorrect relative path");
        if (i > 0)
        {
          localStringBuffer1.append(encode(paramString.substring(0, i), allowed_rel_path, str));
          localStringBuffer1.append(encode(paramString.substring(i), allowed_abs_path, str));
        }
        while (true)
        {
          this._path = localStringBuffer1.toString().toCharArray();
          break label71:
          localStringBuffer1.append(encode(paramString, allowed_rel_path, str));
        }
      }
      if (!(this._is_opaque_part))
        break;
      StringBuffer localStringBuffer2 = new StringBuffer();
      localStringBuffer2.insert(0, encode(paramString.substring(0, 1), uric_no_slash, str));
      localStringBuffer2.insert(1, encode(paramString.substring(1), uric, str));
      this._opaque = localStringBuffer2.toString().toCharArray();
    }
    throw new URIException(1, "incorrect path");
  }

  public void setQuery(String paramString)
    throws URIException
  {
    char[] arrayOfChar;
    if ((paramString == null) || (paramString.length() == 0))
      if (paramString == null)
      {
        arrayOfChar = null;
        label17: this._query = arrayOfChar;
        setURI();
      }
    while (true)
    {
      return;
      arrayOfChar = paramString.toCharArray();
      break label17:
      setRawQuery(encode(paramString, allowed_query, getProtocolCharset()));
    }
  }

  public void setRawAuthority(char[] paramArrayOfChar)
    throws URIException, NullPointerException
  {
    parseAuthority(new String(paramArrayOfChar), true);
    setURI();
  }

  public void setRawFragment(char[] paramArrayOfChar)
    throws URIException
  {
    if ((paramArrayOfChar == null) || (paramArrayOfChar.length == 0))
      this._fragment = paramArrayOfChar;
    for (this.hash = 0; ; this.hash = 0)
    {
      return;
      if (!(validate(paramArrayOfChar, fragment)))
        throw new URIException(3, "escaped fragment not valid");
      this._fragment = paramArrayOfChar;
    }
  }

  public void setRawPath(char[] paramArrayOfChar)
    throws URIException
  {
    if ((paramArrayOfChar == null) || (paramArrayOfChar.length == 0))
    {
      this._opaque = paramArrayOfChar;
      this._path = paramArrayOfChar;
      setURI();
      label23: return;
    }
    char[] arrayOfChar = removeFragmentIdentifier(paramArrayOfChar);
    if ((this._is_net_path) || (this._is_abs_path))
    {
      if (arrayOfChar[0] != '/')
        throw new URIException(1, "not absolute path");
      if (!(validate(arrayOfChar, abs_path)))
        throw new URIException(3, "escaped absolute path not valid");
      this._path = arrayOfChar;
    }
    while (true)
    {
      setURI();
      break label23:
      if (this._is_rel_path)
      {
        int i = indexFirstOf(arrayOfChar, '/');
        if (i == 0)
          throw new URIException(1, "incorrect path");
        if (((i > 0) && (!(validate(arrayOfChar, 0, i - 1, rel_segment))) && (!(validate(arrayOfChar, i, -1, abs_path)))) || ((i < 0) && (!(validate(arrayOfChar, 0, -1, rel_segment)))))
          throw new URIException(3, "escaped relative path not valid");
        this._path = arrayOfChar;
      }
      if (!(this._is_opaque_part))
        break;
      if ((!(uric_no_slash.get(arrayOfChar[0]))) && (!(validate(arrayOfChar, 1, -1, uric))))
        throw new URIException(3, "escaped opaque part not valid");
      this._opaque = arrayOfChar;
    }
    throw new URIException(1, "incorrect path");
  }

  public void setRawQuery(char[] paramArrayOfChar)
    throws URIException
  {
    if ((paramArrayOfChar == null) || (paramArrayOfChar.length == 0))
    {
      this._query = paramArrayOfChar;
      setURI();
    }
    while (true)
    {
      return;
      char[] arrayOfChar = removeFragmentIdentifier(paramArrayOfChar);
      if (!(validate(arrayOfChar, query)))
        throw new URIException(3, "escaped query not valid");
      this._query = arrayOfChar;
      setURI();
    }
  }

  protected void setURI()
  {
    StringBuffer localStringBuffer = new StringBuffer();
    if (this._scheme != null)
    {
      localStringBuffer.append(this._scheme);
      localStringBuffer.append(':');
    }
    if (this._is_net_path)
    {
      localStringBuffer.append("//");
      if (this._authority != null)
        localStringBuffer.append(this._authority);
    }
    if ((this._opaque != null) && (this._is_opaque_part))
      localStringBuffer.append(this._opaque);
    while (true)
    {
      if (this._query != null)
      {
        localStringBuffer.append('?');
        localStringBuffer.append(this._query);
      }
      this._uri = localStringBuffer.toString().toCharArray();
      this.hash = 0;
      return;
      if ((this._path == null) || (this._path.length == 0))
        continue;
      localStringBuffer.append(this._path);
    }
  }

  public String toString()
  {
    return getEscapedURI();
  }

  protected boolean validate(char[] paramArrayOfChar, int paramInt1, int paramInt2, BitSet paramBitSet)
  {
    if (paramInt2 == -1)
      paramInt2 = paramArrayOfChar.length - 1;
    int i = paramInt1;
    if (i <= paramInt2)
      label14: if (paramBitSet.get(paramArrayOfChar[i]));
    for (int j = 0; ; j = 1)
    {
      return j;
      i += 1;
      break label14:
    }
  }

  protected boolean validate(char[] paramArrayOfChar, BitSet paramBitSet)
  {
    return validate(paramArrayOfChar, 0, -1, paramBitSet);
  }

  public static class DefaultCharsetChanged extends RuntimeException
  {
    public static final int DOCUMENT_CHARSET = 2;
    public static final int PROTOCOL_CHARSET = 1;
    public static final int UNKNOWN;
    private String reason;
    private int reasonCode;

    public DefaultCharsetChanged(int paramInt, String paramString)
    {
      super(paramString);
      this.reason = paramString;
      this.reasonCode = paramInt;
    }

    public String getReason()
    {
      return this.reason;
    }

    public int getReasonCode()
    {
      return this.reasonCode;
    }
  }

  public static class LocaleToCharsetMap
  {
    private static final Hashtable LOCALE_TO_CHARSET_MAP = new Hashtable();

    static
    {
      LOCALE_TO_CHARSET_MAP.put("ar", "ISO-8859-6");
      LOCALE_TO_CHARSET_MAP.put("be", "ISO-8859-5");
      LOCALE_TO_CHARSET_MAP.put("bg", "ISO-8859-5");
      LOCALE_TO_CHARSET_MAP.put("ca", "ISO-8859-1");
      LOCALE_TO_CHARSET_MAP.put("cs", "ISO-8859-2");
      LOCALE_TO_CHARSET_MAP.put("da", "ISO-8859-1");
      LOCALE_TO_CHARSET_MAP.put("de", "ISO-8859-1");
      LOCALE_TO_CHARSET_MAP.put("el", "ISO-8859-7");
      LOCALE_TO_CHARSET_MAP.put("en", "ISO-8859-1");
      LOCALE_TO_CHARSET_MAP.put("es", "ISO-8859-1");
      LOCALE_TO_CHARSET_MAP.put("et", "ISO-8859-1");
      LOCALE_TO_CHARSET_MAP.put("fi", "ISO-8859-1");
      LOCALE_TO_CHARSET_MAP.put("fr", "ISO-8859-1");
      LOCALE_TO_CHARSET_MAP.put("hr", "ISO-8859-2");
      LOCALE_TO_CHARSET_MAP.put("hu", "ISO-8859-2");
      LOCALE_TO_CHARSET_MAP.put("is", "ISO-8859-1");
      LOCALE_TO_CHARSET_MAP.put("it", "ISO-8859-1");
      LOCALE_TO_CHARSET_MAP.put("iw", "ISO-8859-8");
      LOCALE_TO_CHARSET_MAP.put("ja", "Shift_JIS");
      LOCALE_TO_CHARSET_MAP.put("ko", "EUC-KR");
      LOCALE_TO_CHARSET_MAP.put("lt", "ISO-8859-2");
      LOCALE_TO_CHARSET_MAP.put("lv", "ISO-8859-2");
      LOCALE_TO_CHARSET_MAP.put("mk", "ISO-8859-5");
      LOCALE_TO_CHARSET_MAP.put("nl", "ISO-8859-1");
      LOCALE_TO_CHARSET_MAP.put("no", "ISO-8859-1");
      LOCALE_TO_CHARSET_MAP.put("pl", "ISO-8859-2");
      LOCALE_TO_CHARSET_MAP.put("pt", "ISO-8859-1");
      LOCALE_TO_CHARSET_MAP.put("ro", "ISO-8859-2");
      LOCALE_TO_CHARSET_MAP.put("ru", "ISO-8859-5");
      LOCALE_TO_CHARSET_MAP.put("sh", "ISO-8859-5");
      LOCALE_TO_CHARSET_MAP.put("sk", "ISO-8859-2");
      LOCALE_TO_CHARSET_MAP.put("sl", "ISO-8859-2");
      LOCALE_TO_CHARSET_MAP.put("sq", "ISO-8859-2");
      LOCALE_TO_CHARSET_MAP.put("sr", "ISO-8859-5");
      LOCALE_TO_CHARSET_MAP.put("sv", "ISO-8859-1");
      LOCALE_TO_CHARSET_MAP.put("tr", "ISO-8859-9");
      LOCALE_TO_CHARSET_MAP.put("uk", "ISO-8859-5");
      LOCALE_TO_CHARSET_MAP.put("zh", "GB2312");
      LOCALE_TO_CHARSET_MAP.put("zh_TW", "Big5");
    }

    public static String getCharset(Locale paramLocale)
    {
      String str1 = (String)LOCALE_TO_CHARSET_MAP.get(paramLocale.toString());
      if (str1 != null);
      for (String str2 = str1; ; str2 = (String)LOCALE_TO_CHARSET_MAP.get(paramLocale.getLanguage()))
        return str2;
    }
  }
}

/* Location:           E:\Desktop\Android\wordstd\classes_dex2jar.jar
 * Qualified Name:     org.apache.commons.httpclient.URI
 * JD-Core Version:    0.5.3
 */